cmake_minimum_required(VERSION 2.6)
project(CV_Assistant)

set(CMAKE_CXX_FLAGS "-std=c++11 ")

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/test_runtime)
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(Eigen3 REQUIRED)
find_package(OpenCV 3.4 REQUIRED)
find_package(PCL 1.9 REQUIRED)

include_directories(
        ${OpenCV_INCLUDE_DIRS}
        ${Eigen_INCLUDE_DIRS}
        ${PCL_INCLUDE_DIRS}
        ${PROJECT_SOURCE_DIR}/include

)

add_definitions( ${PCL_DEFINITIONS} )
link_directories( ${PCL_LIBRARY_DIRS} )

#Image Processing Library
add_library(${PROJECT_NAME}_ImageProcessing SHARED
        src/ImageProcessing/SmallTools.cpp
        )
target_link_libraries(${PROJECT_NAME}_ImageProcessing
        ${OpenCV_LIBS}
        )

#PointCloud Processing Library
add_library(${PROJECT_NAME}_PointcloudProcessing SHARED
        #include/PointcloudProcessing/FilterUtilities.h
        src/PointcloudProcessing/FilterUtilities.cpp
        )
target_link_libraries(${PROJECT_NAME}_PointcloudProcessing
        ${OpenCV_LIBS}
        ${PCL_LIBRARIES}
        )

#Math Helper Library
add_library(${PROJECT_NAME}_MathHelper SHARED
        src/MathHelper/MathHelper.cpp
        src/MathHelper/Converter.cpp
        )

target_link_libraries(${PROJECT_NAME}_MathHelper
        ${OpenCV_LIBS}
        )

#For developer debuging
add_executable(test_img_proc src/Test_ImgProc.cpp)
target_link_libraries(test_img_proc ${PROJECT_NAME}_ImageProcessing)

add_executable(test_PC_proc src/Test_PclProc.cpp)
target_link_libraries(test_PC_proc ${PROJECT_NAME}_PointcloudProcessing)

add_executable(math_proc src/MathProc.cpp)
target_link_libraries(math_proc ${PROJECT_NAME}_MathHelper)



#Applications
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/apps)

add_executable(cloud_y-cut src/apps/cloud_y-cut.cpp)
target_link_libraries(cloud_y-cut ${PROJECT_NAME}_PointcloudProcessing)

add_executable(cloud_area-cut src/apps/cloud_area-cut.cpp)
target_link_libraries(cloud_area-cut ${PROJECT_NAME}_PointcloudProcessing)

add_executable(cloud_select-y-cut src/apps/cloud_select-y-cut.cpp)
target_link_libraries(cloud_select-y-cut ${PROJECT_NAME}_PointcloudProcessing)

add_executable(cloud_removeStats src/apps/cloud_removeStats.cpp)
target_link_libraries(cloud_removeStats ${PROJECT_NAME}_PointcloudProcessing)

add_executable(cloud_y-project src/apps/cloud_y-project.cpp)
target_link_libraries(cloud_y-project ${PROJECT_NAME}_PointcloudProcessing)

add_executable(cloud_toGrid src/apps/cloud_toGrid.cpp)
target_link_libraries(cloud_toGrid ${PROJECT_NAME}_PointcloudProcessing)

